<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //基本用法
    let[x,y]= [1,2];
    console.log(x, y); //1,2
    //剩余运算符
    let a, b, rest;
    [a, b,...rest]=[1,2,3,4,5,6];
    console.log(a, b, rest); //rest [3,4,5,6]
    //可忽略
    let[a,,b] =[1,2,3];
    console.log(a, b);//1 3
    //不完全解构
    let[a,b]= [1];
    console.log(a, b); //1 undefined
    //解构默认值
    let[a,b=2]=[1];
    console.log(a, b);// 1 2
    //对字符串进行解构赋值
    let[a,b,c,d,e] ="Hell";
    console.log(a,b,c,d,e);//H e l l undefined

</script>
</html>